﻿

function main() {
    showLog("抖音(同城点赞)");
    var testVersion = "(201901021555)版";
    var softwareName = "抖音";
    var view = RequestEngine.getWebView();
    var viewJson = JSON.parse(view);
    var search = viewJson.search;
    var terminationNum = viewJson.terminationNum;

    AccessibilityEngine.sleepEngine(10000);//等待

    if (AccessibilityEngine.checkUpId(widget.pages.shouye.wzdl) == ISTRUE) { //我知道了
        AccessibilityEngine.mockOnClickId(widget.pages.shouye.wzdl);
    }
    if (AccessibilityEngine.checkUpId(widget.pages.shouye.bugengxin) == ISTRUE) { //更新以后再说
        AccessibilityEngine.mockOnClickId(widget.pages.shouye.bugengxin);
    }


    if (AccessibilityEngine.checkUpText("同城")==ISTRUE ) {		
        AccessibilityEngine.mockOnClickIdText("com.ss.android.ugc.aweme:id/den", "同城"); //点击同城
    }else{
	     AccessibilityEngine.mockOnClickId("com.ss.android.ugc.aweme:id/dyx");
	}
	
    if (AccessibilityEngine.checkUpId(widget.pages.shouye.bugengxin) == ISTRUE) { //更新以后再说
        AccessibilityEngine.mockOnClickId(widget.pages.shouye.bugengxin);
    }
    AccessibilityEngine.sleepEngine(2000);//等待
//	if(AccessibilityEngine.checkUpId("com.ss.android.ugc.aweme:id/a01") == ISTRUE){
//		if (AccessibilityEngine.checkUpId("com.ss.android.ugc.aweme:id/bb3") == ISTRUE) {
//			ScreenEngine.swipe(parseX(300), parseY(1000), parseX(300), parseY(200), 500); //从下往上滑动		
//			AccessibilityEngine.mockOnClickId("com.ss.android.ugc.aweme:id/a01");
//			for (var i =0 ; i <search; i ++ ){  // 循环滑动
//				dianZan();
//				AccessibilityEngine.sleepEngine(3000);
//				ScreenEngine.swipe(parseX(300), parseY(1000), parseX(300), parseY(200), 500); //从下往上滑动
//			}
//		}
//	}
	
		if(AccessibilityEngine.checkUpId("com.ss.android.ugc.aweme:id/bnh") == ISTRUE){
			for (var j =0 ; j <9999; j ++ ){  // 循环滑动
				if (AccessibilityEngine.checkUpId(widget.pages.shouye.bugengxin) == ISTRUE) { //更新以后再说
					AccessibilityEngine.mockOnClickId(widget.pages.shouye.bugengxin);
				}
				if (AccessibilityEngine.checkUpId("com.ss.android.ugc.aweme:id/bo_") == ISTRUE) {
					ScreenEngine.swipe(parseX(300), parseY(1000), parseX(300), parseY(500), 500); //从下往上滑	
				}else{
					break;
				}
			}
			AccessibilityEngine.mockOnClickId("com.ss.android.ugc.aweme:id/bnh");
			for (var i =0 ; i <search; i ++ ){  // 循环滑动
				if (AccessibilityEngine.checkUpId(widget.pages.shouye.bugengxin) == ISTRUE) { //更新以后再说
					AccessibilityEngine.mockOnClickId(widget.pages.shouye.bugengxin);
				}
				dianZan();
				AccessibilityEngine.sleepEngine(3000);
				ScreenEngine.swipe(parseX(300), parseY(1000), parseX(300), parseY(200), 500); //从下往上滑动
			}
		}else{
		       setTaskState("6", "脚本执行失败");
               throw SyntaxError();
		
		}
	




    setTaskState("5", "脚本执行完毕");
    //throw SyntaxError();
	 function dianZan() {//830
        AccessibilityEngine.sleepEngine(1000);//等待
        var pressDianZan = "press," + parseX(250) + "," + parseY(350);
        ScreenEngine.currency(pressDianZan);
        AccessibilityEngine.sleepEngine(50);
        ScreenEngine.currency(pressDianZan);
        AccessibilityEngine.sleepEngine(50);
        ScreenEngine.currency(pressDianZan);
        AccessibilityEngine.sleepEngine(50);
        ScreenEngine.currency(pressDianZan);
        AccessibilityEngine.sleepEngine(50);
        ScreenEngine.currency(pressDianZan);
        AccessibilityEngine.sleepEngine(50);
        ScreenEngine.currency(pressDianZan);
        AccessibilityEngine.sleepEngine(1000);//等待
    }
}
var publicfunction = RequestEngine.getPluginPath() + "OS_DYCOMMON/publicfunction.js";
include(publicfunction); //公共方法js
var widgetPath = dyConditionCheck();
var widgetbyid = RequestEngine.getPluginPath() +"OS_DYCOMMON/"+ widgetPath;
include(widgetbyid);
main();
